<style>
    .table > thead > tr > th, .table > tbody > tr > td {
        white-space: nowrap;
    }
    .table-responsive {
        max-height: calc(80vh);
    }
    .form-copy {
        margin-right: 5px;
        border-radius: 0;
        box-shadow: none;
        padding: 4px 12px 7px 12px;
        font-size: 14px;
        line-height: 1.42857143;
        color: #555;
        border: 1px solid #ccc;
        transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
    }
    .select2 {
        margin-right: 5px
    }
</style>

    <table class="table table-hover grid-table">
        <thead>
        <tr>
            <th><input type="checkbox" class="grid-select-all"/></th>
            <th>ID</th>
            <th>品类1</th>
            <th>SKUID2</th>
            <th>SKU编码2</th>
            <th>SKU名称2</th>
            <th>产品状态2</th>
            <th>国家3</th>
            <th>是否启用1</th>
            <th>是否启用2</th>
            <th>是否启用3</th>
        </tr>
        </thead>

            @foreach($paginator as $row)
            <tr id="classify">
                {{--<td><input type="checkbox" class="grid-row-checkbox"></td>--}}
                <td>
                    <input type="checkbox" class="grid-row-checkbox"
                           id="{{ 'classify_'. $row->id }}"
                           value="{{ $row->id ?? '' }}"
                           data-classify-id="{{ $row->id ?? '' }}" />
                </td>
                <td>{{ $row->id ?? '' }}</td>
                <td>{{ $row->title ?? '' }}</td>
                <td>{{ $row->psku_id ?? '' }}</td>
                <td>{{ $row->psku_code ?? '' }}</td>
                <td>{{ $row->psku_cn ?? '' }}</td>
                <td>{{ '' }}</td>
                <td>{{ '' }}</td>
                <td>{{ \App\Models\Product\ProductClassify::$_status[$row->status] ?? '' }}</td>
                <td>{{ '' }}</td>
                <td>{{ '' }}</td>

                <?php $skuList = App\Models\Product\ProductSku::query()->where('classify_id', $row->id)->get(); ?>
                @foreach($skuList as $item)
                <tr id="sku">
                    <td>{{ '' }}</td>
                    {{--<td><input type="checkbox" class="grid-row-checkbox"></td>--}}
                    <td>
                        <input type="hidden" class="grid-row-checkbox"
                               id="{{ 'sku_'. $row->id .'_'. $item->id }}"
                               value="{{ $item->id ?? '' }}"
                               data-psku-id="{{ $item->id ?? '' }}"
                               data-classify-id="{{ $row->id ?? '' }}" />
                    </td>
                    <td>{{ '' }}</td>
                    <td>{{ $item->id ?? '' }}</td>
                    <td>{{ $item->psku_cn ?? '' }}</td>
                    <td>{{ $item->psku_code ?? '' }}</td>
                    <td>{{ \App\Models\Product\ProductSku::$_pSkuStatus[$item->psku_status] ?? '' }}</td>
                    <td>{{ '' }}</td>
                    <td>{{ '' }}</td>
                    <td>{{ \App\Models\Product\ProductSku::$_status[$item->status] ?? '' }}</td>
                    <td>{{ '' }}</td>

                    <?php $amazonSkuList = App\Models\Product\ProductAmazonSku::query()->where('psku_id', $item->id)->get(); ?>
                    @foreach($amazonSkuList as $val)
                    <tr id="amazon">
                        <td>{{ '' }}</td>
                        <td>{{ '' }}</td>
                        <td>
                            <input type="checkbox" name="pskuid[]" class="grid-row-checkbox"
                                   id="{{ 'amazon_'. $row->id .'_'. $item->id .'_' . $val->id }}"
                                   value="{{ $val->id ?? '' }}"
                                   data-id="{{ $val->id ?? '' }}"
                                   data-psku-id="{{ $item->id ?? '' }}"
                                   data-classify-id="{{ $row->id ?? '' }}" />
                        </td>
                        <td>{{ '' }}</td>
                        <td>{{ '' }}</td>
                        <td>{{ '' }}</td>
                        <td>{{ '' }}</td>
                        <td>{{ $val->country->country ?? '' }}</td>
                        <td>{{ '' }}</td>
                        <td>{{ '' }}</td>
                        <td>{{ \App\Models\Product\ProductAmazonSku::$_status[$val->status] ?? '' }}</td>
                    </tr>
                    @endforeach
                </tr>
                @endforeach
            </tr>

            @endforeach
    </table>

<script>
    $(function () {

        $('.grid-row-checkbox').iCheck({checkboxClass:'icheckbox_minimal-blue'});

        //全选
        $('.grid-select-all').iCheck({checkboxClass:'icheckbox_minimal-blue'});
        $('.grid-select-all').on('ifChanged', function(event) {
            if (this.checked) {
                $('.grid-row-checkbox').iCheck('check');
            } else {
                $('.grid-row-checkbox').iCheck('uncheck');
            }
        }).on('ifClicked', function () {
            if (this.checked) {
                $.admin.grid.selects = {};
            } else {
                $('.grid-row-checkbox').each(function () {
                    let id = $(this).data('id');
                    $.admin.grid.select(id);
                });
            }
        });



    });
</script>
